package com.ruitu.mall_98_2.mvp.model;

import com.ruitu.mall_98_2.dao.APIRetrofit;
import com.ruitu.mall_98_2.mvp.contract.ByNowFillInOrderContract;
import com.ruitu.router_module.bean.api.BaseResult;
import com.ruitu.router_module.bean.mine.Coupon;
import com.ruitu.router_module.bean.order.CommitOrder;
import com.ruitu.router_module.bean.order.ConfirOrder;

import java.util.List;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class ByNowFillInOrderModel implements ByNowFillInOrderContract.Model {
    @Override
    public Observable<BaseResult<CommitOrder>> buyNowForSettlement(String accountId, String goodsId, String num, String skuId, String status, String addressId) {
        return APIRetrofit.getDefault().buyNowForSettlement(accountId, goodsId, num, skuId, status, addressId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<BaseResult<ConfirOrder>> buyNowForApp(String accountId, String goodsId, String num, String skuId, String status, String addressId, String couponId) {
        return APIRetrofit.getDefault().buyNowForApp(accountId, goodsId, num, skuId, status, addressId, couponId)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult<List<Coupon>>> selectUseCoupons(String accountId, String userCouponIds, String goodId, String totalMoney, String companyId) {
        return APIRetrofit.getDefault().selectUseCoupons(accountId, userCouponIds, goodId, totalMoney, companyId)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}
